
public class Task implements Comparable<Task> {

	public enum TaskType {
		FOOD, EXPLORE, ATTACK, DEFEND,
	}

	public static class TaskExecutor implements Comparable<TaskExecutor> {
		final Tile ant;
		final Route route;

		public TaskExecutor(Tile ant, Route route) {
			this.ant = ant;
			this.route = route;
		}

		@Override
		public boolean equals(Object obj) {
			if (obj instanceof TaskExecutor) {
				TaskExecutor task = (TaskExecutor) obj;
				return (ant.equals(task.ant)) && (route == task.route);
			}

			return false;
		}

		@Override
		public int compareTo(TaskExecutor task) {
			return this.route.compareTo(task.route);
		}
	}

	public final TaskType type;
	public final Tile target;
	public Tile source;
	public Route route;

	public Task(TaskType type, Tile target) {
		this.type = type;
		this.target = target;
		// this.interestedAnt = new TreeMap<TaskExecutor, TaskExecutor>();
	}

	// public void addInterest(Tile ant, Route route) {
	// TaskExecutor exec = new TaskExecutor(ant, route);
	// this.interestedAnt.put(exec, exec);
	// }
	//
	// public void removeInterest(Tile ant) {
	// this.interestedAnt.remove(ant);
	// }
	//
	// public void clearAllInterest() {
	// this.interestedAnt.clear();
	// }
	//
	// public TaskExecutor getFirstExecutor() {
	// return this.interestedAnt.firstKey();
	// }

	public void reset() {
		source = null;
		route = null;
	}

	public Tile getTarget() {
		return this.target;
	}

	@Override
	public boolean equals(Object obj) {
		boolean result = false;
		if (obj instanceof Task) {
			Task task = (Task) obj;
			result = type == task.type && target.equals(task.target);
		}
		return result;
	}

	@Override
	public int compareTo(Task task) {
		return this.route.compareTo(task.route);
	}

	// public void setOwner(Tile ant) {
	// this.ant = ant;
	// }
	//
	// public Tile getOwner() {
	// return this.ant;
	// }

	// public void setRoute(Route route) {
	// this.route = route;
	// }
	//
	// public Route getRoute() {
	// return route;
	// }

	// @Override
	// public int compareTo(Task task) {
	// return this.route.compareTo(task.route);
	// }
}
